package com.mebs.edi.model.edi.e214;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import com.mebs.edi.model.dom.DomAttribute;
import com.mebs.edi.model.dom.DomEntity;

/**
 * 
 * G62 section (representing Date) of a 211 EDI file 
 * 
 * @author nit
 *
 */
@Embeddable
@DomEntity(name = "G62", discriminatorAttribute = "G6201", discriminatorValues = {"69", "17", "70", ""})
public class Edi214G62 {
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6201; 		// Date Qualifier
	
	@Column(nullable = true)
	@DomAttribute
	private Date g6202; 		// Date
	
	public Edi214G62() {
		super();
	}
	
	public String getG6201() {
		return g6201;
	}

	public void setG6201(String g6201) {
		this.g6201 = g6201;
	}

	public Date getG6202() {
		return g6202;
	}

	public void setG6202(Date g6202) {
		this.g6202 = g6202;
	}

	@Override
	public String toString() {
		return "Edi214G62 [g6201=" + g6201 + ", g6202=" + g6202 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((g6201 == null) ? 0 : g6201.hashCode());
		result = prime * result + ((g6202 == null) ? 0 : g6202.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edi214G62 other = (Edi214G62) obj;
		if (g6201 == null) {
			if (other.g6201 != null)
				return false;
		} else if (!g6201.equals(other.g6201))
			return false;
		if (g6202 == null) {
			if (other.g6202 != null)
				return false;
		} else if (!g6202.equals(other.g6202))
			return false;
		return true;
	}
}
